package com.zkld.frame.controller;

import com.zkld.frame.dto.ResponseDTO;
import com.zkld.frame.entitys.Graphical;
import com.zkld.frame.mapper.GraphicalMapper;
import com.zkld.frame.service.GraphicalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/graphical")
@CrossOrigin
public class GraphicalController {

    @Autowired
    GraphicalService graphicalService;

    @GetMapping("/save")
    public ResponseDTO saveGraphical(Graphical graphical) {
        return graphicalService.saveGraphical(graphical);
    }

    @GetMapping("/info")
    public ResponseDTO getGraphicalInfoByUserId(@RequestParam("userId") String userId) {
        return graphicalService.getGraphicalInfoByUserId(userId);
    }

    @GetMapping("/update")
    public ResponseDTO updateById(Graphical graphical) {
        return graphicalService.update(graphical);
    }
}
